<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:icecore="http://www.icefaces.org/icefaces/core"
	xmlns:ace="http://www.icefaces.org/icefaces/components"
	xmlns:ice="http://www.icesoft.com/icefaces/component">
<h:head>
	<ice:outputStyle href="#{baseMBean.securedOutPutStyleURL}"></ice:outputStyle>
</h:head>
<h:body class="#{baseMBean.securedOutPutBodyClass}">
	<f:loadBundle
		basename="com/avecsys/quotemanager/resources/messages_user"
		var="msgs_user"></f:loadBundle>
	<f:loadBundle
		basename="com/avecsys/quotemanager/resources/messages_common"
		var="msgs_common"></f:loadBundle>
	<c:if test="${baseMBean.menuBarEnabled == 'true'}">
		<h:form id="menuBarForm">
			<icecore:singleSubmit />
			<ice:menuBar styleClass="menuBar">
		        <ice:menuItems value="#{menuBarMBean.menuModel}"/>
		    </ice:menuBar>
	    </h:form>		
	</c:if>
	<h:form id="form">
		<f:event listener="#{loginMBean.isUserSignedIn}" type="preRenderView"></f:event>
		<div class="page-container">
			<div class="pageHeader">
				<ice:panelGrid columns="2">
					<ice:graphicImage url="#{buyerUsersMBean.getImageResourceURL('PAGE_HEADER_ICON_BUYER_USER_INQUIRY')}"></ice:graphicImage>
					<c:choose>
						<c:when test="${buyerUsersMBean.screenModeEdit == 'false'}">
							<ice:outputLabel
								value="#{msgs_user.USER_FORM_HEADER_BUYER_NEW_SECTION_TITLE}"
								styleClass="pageHeaderTitleText"></ice:outputLabel>
						</c:when>
						<c:otherwise>
							<ice:outputLabel
								value="#{msgs_user.USER_FORM_HEADER_BUYER_MODIFY_SECTION_TITLE}"
								styleClass="pageHeaderTitleText"></ice:outputLabel>
						</c:otherwise>
					</c:choose>
				</ice:panelGrid>
			</div>
			<center>
				<div>
					<ice:inputHidden id="buyerID" value="#{buyerUsersMBean.selectedBuyerId}"/>
					<ice:inputHidden id="buyerUserID" value="#{buyerUsersMBean.buyerUsersPojo.buyerUserId}"/>
					<ice:inputHidden value="#{buyerUsersMBean.buyerUsersPojo.userMasterPojo.userId}"/>
					<ice:inputHidden value="#{buyerUsersMBean.buyerUsersPojo.userMasterPojo.version}"/>
					<ice:inputHidden value="#{buyerUsersMBean.buyerUsersPojo.version}"/>
					<ice:inputHidden value="#{buyerUsersMBean.existingEmailAddress}"/>
				</div>
				<div class="fieldsContainer">
					<div class="field_row">
						<ice:outputLabel value="#{msgs_user.USER_FORM_BUYER_COMPANY_NAME}"/>
						<span class="field"> 
							<ice:inputText value="#{buyerUsersMBean.selectedBuyerCompanyName}" readonly="true"/>
						</span> 
						<span class="fieldMessage"></span>
					</div>
					<div class="field_row">
						<ice:outputLabel value="#{msgs_user.USER_FORM_USER_NAME}"/>
						<span class="field"> 
							<ice:inputText id="userNameId" value="#{buyerUsersMBean.buyerUsersPojo.userMasterPojo.userName}" required="true"/>
						</span> 
						<span class="fieldMessage"><ice:message styleClass="iceMsgError" for="userNameId"/></span>
					</div>
					<div class="field_row">
						<ice:outputLabel value="#{msgs_user.USER_FORM_PASSWORD}"/>
						<span class="field"> 
							<ice:inputSecret id="passwordID"
								value="#{buyerUsersMBean.buyerUsersPojo.userMasterPojo.password}"
								required="true">
								<f:validator validatorId="validatorPasswordChangePasswordSame" />
							</ice:inputSecret>
						</span> 
						<span class="fieldMessage"><ice:message styleClass="iceMsgError" style="color:red;" for="passwordID"/></span>
					</div>
					<div class="field_row">
						<ice:outputLabel value="#{msgs_user.USER_FORM_COFIRM_PASSWORD}"/>
						<span class="field"> 
							<ice:inputSecret id="confirmPasswordID" value="#{buyerUsersMBean.confirmPassword}" required="true"/>
						</span> 
						<span class="fieldMessage"><ice:message styleClass="iceMsgError" style="color:red;" for="confirmPasswordID"/></span>
					</div>
					<div class="field_row">
						<ice:outputLabel value="#{msgs_user.USER_FORM_EMAIL}"/>
						<span class="field"> 
							<ice:inputText id="emailId"
								value="#{buyerUsersMBean.buyerUsersPojo.userMasterPojo.email}"
								required="true">
								<f:validator validatorId="emailValidator" />
								<f:validator validatorId="buyerEmailRegisteredCheck" />
							</ice:inputText>
						</span> 
						<span class="fieldMessage"><ice:message styleClass="iceMsgError" style="color:red;" for="emailId"/></span>
					</div>
					<div class="field_row">
						<ice:outputLabel value="#{msgs_user.USER_FORM_IS_ADMIN}"/>
						<span class="field"> 
							<ice:selectBooleanCheckbox value="#{buyerUsersMBean.buyerUsersPojo.isAdmin}"/>
						</span> 
						<span class="fieldMessage"><ice:message styleClass="iceMsgError" style="color:red;" for="isadminId"/></span>
					</div>
					<div>
						<ice:panelGrid columns="2">
							<ice:commandButton value="#{msgs_common.COMMAND_ACTION_SUBMIT}"
								action="#{buyerUsersMBean.actionSaveBuyerUser}"
								styleClass="color green button">
								<f:param name="selectedBuyerId"
									value="#{buyerUsersMBean.selectedBuyerId}"></f:param>
							</ice:commandButton>
							<ice:commandButton value="#{msgs_common.COMMAND_ACTION_CANCEL}"
								immediate="true" action="#{buyerUsersMBean.actionCancel}"
								styleClass="color green button">
								<f:param name="selectedBuyerId"
									value="#{buyerUsersMBean.selectedBuyerId}"></f:param>
							</ice:commandButton>
						</ice:panelGrid>
					</div>
				</div>
			</center>
		</div>
	</h:form>
</h:body>
</html>
